<?php
	$fields_arr = array(
		'name'=>'规则名称',
		'trigger_node_text'=>'发送节点',
		'status'=>'状态',
		'tmpl_name'=>'模板',
		'addtime'=>'添加时间',
		'manager_name'=>'添加人',
	);
	if(!$custom_field_arr){
		$custom_field_arr = array_flip($fields_arr);
	}
	$fields_arr_new = array_merge($custom_field_arr,array_flip($fields_arr));
	$fields_arr_new = array_unique($fields_arr_new);
?>
{include app:admin.inc.header}
<!--tmpl-resource-->
{include app:admin.inc.top}
<link rel="stylesheet" href="/res/js/framework/nestable/nestable.css">
<div class="container-fluid content-body">
	<div class="main">
		<!-- left side start-->

		<section class="left-section">
			<dl id="leftNav" data-type="setting">
				<dt><i class="glyphicon glyphicon-wrench"></i> 网站设置</dt>
				{if in_case_array('admin/setting',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/setting/index}">站点设置</a></dd>
				{/if}
				{if in_case_array('admin/nav',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/nav/index}">导航设置</a></dd>
				{/if}
				{if in_case_array('admin/friendLink',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/friendLink/index}">友情链接</a></dd>
				{/if}
				{if in_case_array('admin/remind',$priv) || empty($priv)}
				<dd><a class="mb active" href="{url /admin/remind/index}">站内提醒</a></dd>
				{/if}
				{if in_case_array('admin/remindSms',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/remindSms/index}">短信提醒</a></dd>
				{/if}
				{if in_case_array('admin/security',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/security/index}">安全中心</a></dd>
				{/if}
				{if in_case_array('admin/remind',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/message/index}">消息中心</a></dd>
				{/if}
				{if in_case_array('admin/loginlog',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/LoginLog/index}">登录日志</a></dd>
				{/if}
				{if in_case_array('admin/operationlog',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/operationLog/index}">操作日志</a></dd>
				{/if}
			</dl>
		</section>

		<!-- left side end-->


		<!-- main content start-->
		<section class="right-section" id="right-section">
			{include admin.inc.bread}
			<ul class="nav nav-tabs">
				<li><a href="{url /admin/remind/index}"><i class="css-list"></i>站内信列表</a></li>
				<li class="active"><a>规则列表</a></li>
				<li><a href="{url /admin/remind/tmplIndex}"><i class="css-list"></i>模板列表</a></li>
			</ul>
			<!-- start of inner-frame -->
			<div class="inner-iframe">

               <div class="inner-container">
                   <form class="form-inline search-form" role="form" id="J_List_Form">
					   <nav class="inline-form clearfix">
						   <div class="r">
							   <div class="css-select-group">
								   <div class="css-select">
									   <div class="chosen">
										   <span></span>
										   <i class="angle-down"></i>
										   <input type="hidden" name="select_mix_option1" value="{$search_arr[select_mix_option1]}">
									   </div>
									   <ul>
										   <li data-value="rule_name">规则名称</li>
									   </ul>
								   </div><input type="text" class="form-control input-sm" maxlength="{maxlength}" placeholder="关键词" name="select_mix_option_value1" value="{$search_arr[select_mix_option_value1]}">
							   </div>
							   <div class="css-select">
								   <div class="chosen">
									   <span></span>
									   <i class="angle-down"></i>
									   <input type="hidden" name="select_mix_option2" value="{$search_arr[select_mix_option2]}">
								   </div>
								   <ul>
									   <li data-value="addtime">添加时间</li>
								   </ul>
							   </div>
							   <div class="form-group">
								   <div class="input-group">

									   <input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
											  name="start_time" value="{$search_arr[start_time]}"
											  placeholder="开始时间" />

									   <div class="input-group-addon">
										   -
									   </div>
									   <input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
											  name="end_time" value="{$search_arr[end_time]}"
											  placeholder="结束时间" />
								   </div>
							   </div>
							   <div class="css-select">
								   <div class="chosen">
									   <span></span>
									   <i class="angle-down"></i>
									   <input type="hidden" name="trigger_node" value="{$search_arr[trigger_node]}">
								   </div>
								   <ul>
									   <li data-value="">-请选择节点-</li>
									   {loop $rule_option_arr $k $v}
									   <li data-value="{$k}">{$v}</li>
									   {/loop}
								   </ul>
							   </div>
							   <div class="css-select">
								   <div class="chosen">
									   <span></span>
									   <i class="angle-down"></i>
									   <input type="hidden" name="status" value="{$search_arr[status]}">
								   </div>
								   <ul>
									   <li data-value="all">-状态-</li>
									   <li data-value="1">-启用-</li>
									   <li data-value="0">-禁用-</li>
								   </ul>
							   </div>

							   <input type="hidden" name="order" value="{$order}">
							   <button type="submit" class="btnlg mb">搜索</button>
							   <input type="hidden" name="pagesize" value="{$pagesize}" >
							   <button type="button" class="btnlg mb" id="defined">配置列表项</button>
						   </div>
					   </nav>

					<!--</form>
					<form id="J_List_Form">-->
						<div class="table-responsive">
							<table id="J_ListTable" class="table  table-hover  table-striped">
								<thead>
									<tr>
										<th width="20">
											<label class="css-checkbox">
												<input type="checkbox" class="check-all">
												<span></span>
											</label>
										</th>
										{loop $custom_field_arr $k $v}
										<th>{$fields_arr[$v]}</th>
										{/loop}
									</tr>
								</thead>
								<tbody>
								{if empty($items)}
								<tr>
									<td style="text-align:center;" colspan="5" class="empty-table-td">{$emptyRecord}</td>
								</tr>
								{/if}
								{loop $items $value}
								<tr>
									<td>
										<label class="css-checkbox">
											<input type="checkbox"  name="ids[]" value="{$value[id]}">
											<span></span>
										</label>
									</td>
									{loop $custom_field_arr $v}
									{if $v=='status'}
									<td>
										<label class="css-switch">
											<input type="checkbox" data-id="{$value[id]}" data-size="mini"
												   {if $value[status]=='启用'}checked{/if} data-on-text="启用" data-off-text="禁用">
											<span></span>
										</label>
									</td>
									{else}
									<td>{$value[$v]}</td>
									{/if}
									{/loop}
								</tr>
								{/loop}
							</table>
						</div>
					</form>
					<div class="text-right" style="float: right">
						{$pagemenu}
					</div>
				</div>
			</div>
		</section>
	</div>
</div>

<!--footer section start-->
{include admin.inc.footer}
<!--footer section end-->

<!--tmpl-script-->

<!-- template -->
<!--自定义start-->
<script id="defined_table" type="text/html">
	<div>
		<form id="defined_edit" class="form-horizontal">
			<input type="hidden" name="url" value="{$module}/{$action}/{$method}">
			<div class="de_title"><i></i>拖动改变顺序</div>
			<div class="cf">
				<div class="dd" id="nestable3">
					<ol class="dd-list">
						{loop $fields_arr_new $v}
						<li class="dd-item dd3-item" data-id="{$v}">
							<div class="dd-handle dd3-handle"></div><div class="dd3-content">
							<label class="css-checkbox">
								<input type="checkbox" {if in_array($v,$custom_field_arr)}checked="checked"{/if} name="field_arr[]" value="{$v}">
								<span>{$fields_arr[$v]}</span>
							</label>
						</div>
						</li>
						{/loop}
					</ol>
				</div>
			</div>
		</form>
	</div>
</script>
<!--自定义end-->

<script id="editpanel" type="text/html">
	<div>
		<form id="editpanel-form" class="form-horizontal">
			<div class="row">&nbsp</div>
			<!--tmpl-fieldlist-->

			<!-- select -->
			<div class="form-group">
				<label>接收用户</label>
				<select class="form-control m-bot15 select2" id="inputto_member_id" name="data[to_member_id]">
					<option value="0">-- 请选择 --</option>
					<!--tmpl-options-->

					<!-- selectoptions -->
					{loop $to_member_idoptions $v}
					<option {if $item[to_member_id] == $v[id]}selected{/if} value="{$v[id]}">{$v[id]}</option>
					{/loop}


				</select>
			</div>
			<p class="help-block"></p>

			<!-- input -->
			<div class="form-group">
				<label >信息内容 </label>
				<input  dtype="" class="form-control" maxlength="255" name="data[message_content]" placeholder="信息内容" required cname="信息内容" value="{[message_content]}" />
			</div>
			<p class="help-block"></p>

			<!-- switch -->
			<div class="form-group">
				<label>是否已读</label>
				<div>
					<input type="checkbox" id="switch-is_read" name="data[is_read]" class="bswitch" data-size="normal" {if $item[is_read]}checked{/if} data-on-text="已读" data-off-text="未读">
				</div>
			</div>


			<!--tmpl-assocfields-->
		</form>
	</div>
</script>

<!-- pagescript -->
<script type="text/javascript">
	seajs.use("admin/message_remindindex",function (parameter){

		/**--tmpl-templatejavascript--**/

		<!--tmpl-templatejavascript-->
		parameter.detailUrl="{$detail_url}";
		parameter.deleteUrl="{$delete_url}";
		parameter.editUrl="{$do_edit_url}";
		parameter.upload_url="{$upload_url}";
		parameter.image_search_url="{$image_search_url}";
		parameter.image_list_url="{$image_list_url}";

		parameter.initByRule();
	});
</script>


<script id="assocpage" type="text/html">
<div class="text-right">
	<ul class="pagination blog-pagination">
		<li><a class="assoc-page" data-page="{[prev]}" href="javascript:void(0);">上一页</a></li>
		{[loop pages page]}

		<li {[if curr == page]}class="active"{[/if]}><a class="assoc-page" data-page="{[page]}"  href="javascript:void(0)">{[page]}</a></li>

		{[/loop]}
		<li><a class="assoc-page" href="javascript:void(0);" data-page="{[nexts]}">下一页</a></li>
	</ul>
</div>
</script>
</body>
</html>
